- Cooler than parking tickets
- Access to ~31,000 observations, over 5 years!
- Have you seen The Wire?
2/4/2018
library(sf) %>% tidyverse for spatial data explorationlibrary(spdep) and glm()library(geojsonio) # get ODP data library(tidyverse) # duh library(magrittr) # %<>% life library(viridis) # it's pretty library(sf) # the new kid library(spdep) # the grandaddy
Top 3 address for drug crime and not drug crime
arrange(crime_counts, -n) %>% group_by(drug_flag) %>% slice(1:3)
## # A tibble: 6 x 3 ## # Groups: drug_flag [2] ## address drug_flag n ## <chr> <chr> <int> ## 1 600 E MARKET ST Charlottesville VA drugs 410 ## 2 400 GARRETT ST Charlottesville VA drugs 38 ## 3 700 PROSPECT AVE Charlottesville VA drugs 38 ## 4 600 E MARKET ST Charlottesville VA not_drugs 635 ## 5 700 PROSPECT AVE Charlottesville VA not_drugs 412 ## 6 1100 5TH ST SW Charlottesville VA not_drugs 341
The police station's address is 606 E Market Street….
"The answer is quite simple - when individuals walk in to the police department to file a report the physical address of the department (606 E Market Street) is often used in that initial report if no other known address is available at the time. This is especially true for incidents of found or lost property near the downtown mall where there is no true known incident location. The same is true for any warrant services that result in a police report occurring at the police department." - CPD
station_props <- arrange(crime_counts, -n) %>%
group_by(drug_flag) %>%
add_count(wt = n) %>%
slice(1)
with(station_props, prop.test(n, nn)) %>% tidy
## estimate1 estimate2 statistic p.value parameter conf.low conf.high ## 1 0.2221018 0.02175626 2135.459 0 1 0.1810225 0.2196687 ## method ## 1 2-sample test for equality of proportions with continuity correction ## alternative ## 1 two.sided
No, they are not.
Census blocks make a lot of sense because:
library(tidycensus)